import numpy as np
import matplotlib.pyplot as plt

# plot two spectrograms with imshow

def plot_spectrograms(spectrogram1, spectrogram2, title1='Spectrogram 1', title2='Spectrogram 2'):
    fig, axs = plt.subplots(1, 2, figsize=(12, 6))
    
    cax1 = axs[0].imshow(spectrogram1, aspect='auto', origin='lower', cmap='jet')
    axs[0].set_title(title1)
    fig.colorbar(cax1, ax=axs[0])
    
    cax2 = axs[1].imshow(spectrogram2, aspect='auto', origin='lower', cmap='jet')
    axs[1].set_title(title2)
    fig.colorbar(cax2, ax=axs[1])
    
    plt.tight_layout()
    plt.savefig("spectrograms_comparison.png")